#include<iostream>
#include"AvlTree.h"
#include<time.h>
int main()
{
	AvlTree<int> AVT;
	AvlTree<double> AVTD;
	
	time_t s1,e1,s2,e2,s3,e3,s4,e4;
	for(int i=1; i<=100; i++)
	{
		AVT.insert(i);
		AVTD.insert(i);
	}	
	s1=clock();
	AVT.limitedprint(1,100);
	e1=clock();
	double t1=double(e1-s1)/CLOCKS_PER_SEC;
	for(int i=101; i<=1000; i++)
	{
		AVT.insert(i);
	}
	s1=clock();
	AVT.limitedprint(1,100);
	e1=clock();
	double t2=double(e1-s1)/CLOCKS_PER_SEC;
	for(int i=1001; i<=10000; i++)
	{
		AVT.insert(i);
	}
	s1=clock();
	AVT.limitedprint(1,100);
	e1=clock();
	double t3=double(e1-s1)/CLOCKS_PER_SEC;
	for(int i=10001; i<=100000; i++)
	{
		AVT.insert(i);
	}
	s1=clock();
	AVT.limitedprint(1,100);
	e1=clock();
	double t4=double(e1-s1)/CLOCKS_PER_SEC;

	s1=clock();
	AVT.limitedprint(1,1000);
	e1=clock();
	s2=clock();
	AVT.limitedprint(1,2000);
	e2=clock();
	s3=clock();
	AVT.limitedprint(1,10000);
	e3=clock();
	s4=clock();
	AVT.limitedprint(1,20000);
	e4=clock();
	std::cout<<"just all right: 50 <=***<= 60"<<std::endl;
	AVT.limitedprint(50,60);
	std::cout<<"not in list: 50.5 <=***<= 60.5"<<std::endl;
	AVTD.limitedprint(50.5,60.5);
	std::cout<<"k1==k2 we should throw out k1(k2)"<<std::endl;
	AVT.limitedprint(50,50);	
	std::cout<<"test4: "<<t1<<"\t"<<t2<<"\t"<<t3<<"\t"<<t4<<"\t"<<std::endl;
	std::cout<<"test5: "<<double(e1-s1)/CLOCKS_PER_SEC<<"\t"<<double(e2-s2)/CLOCKS_PER_SEC<<"\t"<<double(e3-s3)/CLOCKS_PER_SEC<<"\t"<<double(e4-s4)/CLOCKS_PER_SEC<<"\t"<<std::endl;
	

	
	return 0;
}

